colorchooserwidget: Get rid of a gtk_widget_destroy() call
authorTimm Bäder <mail@baedert.org>
Thu, 20 Feb 2020 16:54:56 +0000 (17:54 +0100)
committerTimm Bäder <mail@baedert.org>
Tue, 25 Feb 2020 09:43:15 +0000 (10:43 +0100)
gtk/gtkcolorchooserwidget.c

index 269c6a26e86c4e2593cf93dac963cc9f00b0d3f6..bda681e7aba8154e7bbcff016ca8350d2e4be8bf 100644 (file)
@@ -803,20 +803,16 @@ add_custom_color (GtkColorChooserWidget *cc,
                   const GdkRGBA         *color)
 {
   GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc);
-  GtkWidget *last;
   GtkWidget *p;
   GList *children;
 
   children = gtk_container_get_children (GTK_CONTAINER (priv->custom));
   if (g_list_length (children) >= 9)
     {
-      last = g_list_last (children)->data;
-      if (last == GTK_WIDGET (priv->current))
-        priv->current = NULL;
+      GtkWidget *last = gtk_widget_get_last_child (priv->custom);
 
-      gtk_widget_destroy (last);
+      gtk_container_remove (GTK_CONTAINER (priv->custom), last);
     }
-
   g_list_free (children);
 
   p = gtk_color_swatch_new ();